import { lazy } from 'react'

// 定义二级路由表
export const indexRoutes = [
  {
    path: '/en',
    element: lazy(() => import('@/pages/index/articles/Index')),
    meta: {
      title: 'Articles'
    }
  },
  {
    path: '/archives',
    element: lazy(() => import('@/pages/index/archives/Index')),
    meta: {
      title: 'Archives'
    }
  },
  {
    path: '/knowledge',
    element: lazy(() => import('@/pages/index/knowledgeBooks/Index')),
    meta: {
      title: 'KnowledgeBooks'
    }
  }
]
// 定义路由表
const routes = {
  // 设置模式
  mode: 'history',
  routes: [
    {
      path: '/',
      element: lazy(() => import('@/pages/index/Index')),
      children: [
        ...indexRoutes,
        {
          path: '/',
          to: '/en'
        }
      ]
    },
    {
      path: '/*',
      element: lazy(() => import('@/pages/404'))
    },
    {
      path: '/category/:id',
      element: lazy(() => import('@/pages/category/Index'))
    },
    {
      path: '/client/:id',
      element: lazy(() => import('@/pages/client/Index'))
    },
    {
      path: '/details/:id',
      element: lazy(() => import('@/pages/index/details/Index'))
    }
  ]
}

export default routes
